package gtkwire.widget;

import gtkwire.*;
import gtkwire.widget.utils.GtkJustification;
import gtkwire.widget.utils.GtkWrapMode;

/**
*A widget that displays medium to large amonts of text.
*/
public class GtkTextView extends GtkContainer
{
        public GtkTextView()
        {
		super();
		this.widgetType = WT_GtkTextView;
		gtkCreate();
        }

        public GtkTextView( String name, GladeKey key )
        {
		super( name, key );
		this.widgetType = WT_GtkTextView;
        }
	
	/**
	*Sets the default justification of text in text_view. Tags in the view's buffer may override the default.
	*/
	public void setJustification( GtkJustification mode )
	{
		app().sendCommand( name, GTKWireCommand.SET_INTEND, mode.getMode() );
	}

	/**
	* Sets the default indentation for paragraphs in text_view. Value in pixels. Tags in the buffer may override the default.
	*/
	public void setParagraphIndent( int pix )
	{
		app().sendCommand( name, GTKWireCommand.SET_INTEND, pix );
	}
	
	/**
	*Sets the line wrapping for the view.
	*/
	public void setWrapMode( GtkWrapMode mode )
	{
		app().sendCommand( name, GTKWireCommand.SET_WRAP, mode.getMode() );
	}

	/**
	*Sets the default editability of the GtkTextView. You can override this default 
	*setting with tags in the buffer, using the "editable" attribute of tags.
	*/
	public void setEditable( boolean b )
	{
		app().sendCommand( name, GTKWireCommand.SET_EDITABLE, b );
	}

	/**
	*Sets contents of view. 
	*/
	public void setText( String text )
	{
		app().sendCommand( name, GTKWireCommand.SET_TEXT, text );
	}
	
	/**
	*Return contents of view.
	*/
	public String getText()
	{
		GTKWireMessage answer = app().sendCommandRequest( name, widgetType, GTKWireCommandRequest.GET_TEXT, null );
		return (String) answer.getMessageObject();
	}

}//end class